package yyx;
//官员
public class  Official{
	String name;
	String position;
	int ability;
	int loyalty;
	float money;
	
	public Official(String name, String position, int ability, int loyalty, int money) {
        this.name = name;
        this.position = position;
        this.ability = ability;
        this.loyalty = loyalty;
        this.money = money;
    }
	
	public void showInfo() {
        System.out.println("该官员的姓名为" + name);
        System.out.println("该官员的职位为" + position);
        System.out.println("该官员的能力为" + ability);
        System.out.println("该官员的忠诚度为" + loyalty);
    }
	
	public void appoint(String newPosition, int changeLoyalty) {
        position = newPosition;
        loyalty += changeLoyalty;
        System.out.println(name + "被任命为" + newPosition);
        System.out.println("忠诚度变成了" + loyalty);
    }

	public void reward(float getMoney, int changeLoyalty) {
        money += getMoney;
        loyalty += changeLoyalty;
        System.out.println(name + "被赏赐了" + getMoney + "块钱");
        System.out.println("忠诚度变成了" + loyalty);
    }
	
	public void punish(float deMoney, int changeLoyalty) {
        money -= deMoney;
        loyalty -= changeLoyalty;
        System.out.println(name + "被惩罚了" + deMoney + "块钱");
        System.out.println("忠诚度变成了" + loyalty);
    }
}